package com.lg.algorithm.collections.queue.disruptor;

/**
 * @author: lg
 * @date: 2022-06-21 20:26
 **/
public class Test {
    public static void main(String[] args) {

        System.out.println(1 << 2);
//        System.out.println(log2(0));
//        System.out.println(log2(1));
//        System.out.println(log2(2));
//        System.out.println(log2(3));
//        System.out.println(log2(4));
    }

    public static int log2(int i)
    {
        int r = 0;
        /**
         * i >>= 1
         *    i = i >> 1
         */
        while ((i >>= 1) != 0)
        {
            ++r;
        }
        return r;
    }
}
